<?php
namespace app\common\model\shop\ozon;

use think\admin\Model;
use think\admin\model\SystemUser;

/**
 * OzonGoodsModel
 * ozon商品
 * @Description
 * @package app\common\model\shop\ozon
 * @author wangqinghui
 * @date 2024-11-01 09:29
 */
class OzonBrandModel extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $name = 'shop_brand_ozon';

    // 自动写入时间戳
    protected $autoWriteTimestamp = false;

    /**
     * 日志名称
     * @var string
     */
    protected $oplogName = 'ozon品牌';

    /**
     * 日志类型
     * @var string
     */
    protected $oplogType = 'ozon品牌管理';

    /**
     * 同步状态
     * @return array
     */
    public static function sync_status() : array
    {
        return [0 => lang('未同步'), 1 => lang('已同步')];
    }

    public function userName(): \think\model\relation\HasOne
    {
        return $this->hasOne(SystemUser::class,'id','user_id')->bind(['create_name' => 'username']);
    }

    public function updateName(): \think\model\relation\HasOne
    {
        return $this->hasOne(SystemUser::class,'id','update_user_id')->bind(['update_name' => 'username']);
    }

    public function skuList(): \think\model\relation\HasMany
    {
        return $this->hasMany(OzonGoodsSkuModel::class, 'goods_id');
    }


}